package com.sky.mapper;

import com.sky.entity.OrderDetail;
import com.sky.entity.Orders;
import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderDetailMapper {
    /**
     * 批量新增订单详细信息
     * @param list
     * @return
     */
    int insertBatch(List<OrderDetail> list);

    /**
     * 通过orders传参查询中间表
     * @param orders
     * @return
     */
    @Select("select * from order_detail where order_id = #{id}")
    List<OrderDetail> listByOrders(Orders orders);


    /**
     * orders
     * @param orders
     * @return
     */
    @Delete("delete from order_detail where order_id = #{id}")
    int deleteByOrders(Orders orders);
}
